package com.czxy.demo01;

import java.util.ArrayList;

/**
 * Created by hp on 2020/1/31.
 */
public class Test15 {
    public static void main(String[] args) {
        String str = "<Dog name='小白' color='白色' sons='小黑,小花'/>";
        String[] split = str.replace("'", "").split("<")[1].split("/>")[0].split(" ");
        ArrayList<String>  list=new ArrayList<>();
        list.add(split[3].split("=")[1].split(",")[0]);
        list.add(split[3].split("=")[1].split(",")[1]);
        Dog dog = new Dog(split[1].split("=")[1], split[2].split("=")[1], list);
        System.out.println(dog);
    }
}
